package Demo.cn.tedu;

import java.util.Scanner;

public class Hello {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("欢迎使用电梯");
        System.out.println("请输入当前楼层");
        int floor = scanner.nextInt();
        System.out.println("请输入目标楼层");
        int target = scanner.nextInt();
        while (floor != target) {
            if (floor < target) {
                System.out.println("正在上楼");
                floor++;
            } else {
                System.out.println("正在下楼");
                floor--;
            }
            System.out.println("当前楼层是：" + floor);
            System.out.println("请输入目标楼层");
            target = scanner.nextInt();
            if (floor == target) {
                System.out.println("电梯到达目标楼层");
            }
        }
    }
}
